package code;

import java.io.*;
import java.net.InetAddress;
import java.net.Socket;

public class test {
    public static void main(String[] args) throws IOException {
        // 获取文件并且发送



                Socket socket  = new Socket(InetAddress.getByName("localhost"), 8888);


                BufferedReader bufferedReader = new BufferedReader(new FileReader("E:\\2.txt"));

                PrintWriter printWriter =new PrintWriter(new OutputStreamWriter(socket.getOutputStream()), true);


                BufferedReader bufferResult = new BufferedReader(new InputStreamReader(socket.getInputStream()));

                String line = null;
                while((line = bufferedReader.readLine()) != null) {

                    printWriter.println(line);
                }
//                printWriter.println("having overed");
                socket.shutdownOutput();
                System.out.println(bufferResult.readLine());

    }
}
